<?php

namespace Module\ScheduleManager\Core;

use Illuminate\Events\Dispatcher;
use Illuminate\Support\ServiceProvider;
use ModStart\Admin\Config\AdminMenu;
use ModStart\Core\Dao\ModelManageUtil;

class ModuleServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot(Dispatcher $events)
    {
        AdminMenu::register(function () {
            return [
                [
                    'title' => L('System Manage'),
                    'icon' => 'code-alt',
                    'sort' => 700,
                    'children' => [
                        [
                            'title' => '任务调度',
                            'url' => '\Module\ScheduleManager\Admin\Controller\ScheduleRunController@index',
                        ],
                        ModelManageUtil::hasTable('jobs') ?
                            [
                                'title' => '队列调度',
                                'url' => '\Module\ScheduleManager\Admin\Controller\JobController@index',
                            ] : null,
                    ]

                ],
            ];
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

    }
}
